home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: ncrgw2.ncr.com!ncrhub2!lznj2!lziss3!netnews
- From: Arnold Bursian <arnold.bursian@germany.ncr.com>
- Subject: Re: how to delete data in file? help
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <313DCA0B.8EA@germany.ncr.com>
- Sender: netnews@lziss3.lincroftnj.ncr.com (51[news]-Netnews Admin)
- Content-Transfer-Encoding: 7bit
- Organization: AT&T GIS Lincroft, NJ USA
- References: <4helpk$50c@lantana.singnet.com.sg>
- Mime-Version: 1.0
- Date: Wed, 6 Mar 1996 17:23:23 GMT
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- Mikhail Choo W.M. wrote:
- >
- > HI there,
- > I know this may seem like a real stupid question, but I had to ask. If say
- > for example I needed to delete a string of data form a file, how do I go about
- > doing it. I can't just write over the data to delete, because the result would
- > be a file of the same length with white space chracters. So how does one delete
- > the data in such a way that once the data segment is deleted, the rest of the
- > data would neatly pack themselves over the deleted area to ensure a release of
- > space. I know one way to solve the problem, but it seems very long-winded. The
- > method involves reading all the data in the file to memory, deleteing the
- > unwanted area, and the re-write the data back to clean file. I am currently
- > using Borland C++ 4.5, and I can't find any function that does the job. OK OK,
- > to summerise, the problem is that I can't seem to find a way to directly delete
- > a data segment form a file, without reading into memory first. So any ideas, and
- > help would be greatly appreciated. Thanks in advance .
- > --------------------------------------------------------
- > Yours, Mikhail Choo W. M.
- > Carpedium!
- > E-Mail: mikhail@singnet.com.sg sieze the day...
- > s7700017@singnet.com.sg
- > --------------------------------------------------------
-
- You can't. A data-file is a stream. You can' insert into it and you can't delete from it
-